---
title: "Creencias, actitudes y valores hacia el cambio climático"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(leaflet)
library(ggplot2)
```
Page 1
=====================================
Row {data-height=50}
-----------------------------------------------------------------------
### Edad media
```{r}
edad_media <- 52.8
valueBox(edad_media, "Media de Edad", icon = "fa-users", color = "#AFEEEE")
```
### Nivel de preocupación general por el cambio climático
```{r}
preocupacion_mas_frecuente <- "Algo preocupado"
valueBox(preocupacion_mas_frecuente, "Preocupación por el cambio climático", icon = "fa-leaf", color = "#AFEEEE")
```
### Nivel de responsabilidad hacia la reducción del cambio climático
```{r}
responsabilidad_mas_frecuente <- "Alta"
valueBox(responsabilidad_mas_frecuente, "Responsabilidad para reducir el cambio climático", icon = "fa-hand-paper", color = "#AFEEEE")
```
Row {data-height=50}
-----------------------------------------------------------------------
### Distribución por Género
```{r}
data <- tibble(
Gender = c("Male", "Female"),
Count = c(10271, 11919)
)
plot_ly(data, labels = ~Gender, values = ~Count, type = 'pie',
textinfo = 'label+percent', insidetextorientation = 'radial',
marker = list(colors = c('#B0C4DE', '#D8BFD8')))
```
### Distribución por Nivel de Educación
```{r}
education_data <- tibble(
Education = c("Bajo", "Medio", "Alto"),
Count = c(4911, 4337, 1771)
)
# Crear el gráfico de sectores con un gradiente de colores animado
plot_ly(education_data, labels = ~Education, values = ~Count, type = 'pie',
textinfo = 'label+percent', insidetextorientation = 'radial',
marker = list(colors = c('#FFB6C1', '#FF69B4', '#FF1493')))
```
Page 2
=====================================
Row {data-height=500}
-----------------------------------------------------------------------
## Causas del Cambio Climático y Nivel de Preocupación por el Cambio Climático
```{r}
cause_preocupation_data <- tibble(
Causa = rep(c("Procesos naturales", "Principalmente natural", "Igualmente natural y humano", "Principalmente humano", "Completamente humano"), each = 5),
Preocupacion = rep(c("Nada preocupado", "No muy preocupado", "Algo preocupado", "Muy preocupado", "Extremadamente preocupado"), times = 5),
Conteo = sample(100:500, 25)
)
ggplot(cause_preocupation_data, aes(fill=Preocupacion, y=Conteo, x=Causa)) +
geom_bar(position="stack", stat="identity") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "Causa del Cambio Climático", y = "Conteo", fill = "Nivel de Preocupación") +
scale_fill_manual(values=c("#48C9B0", "#5DADE2", "#5499C7", "#2471A3", "#1F618D"))
```